package model.type;

import java.util.HashMap;
import db.AddressTypeDAO;

public class AddressType {
	public static final int MAIN_ADDRESS = 1, ALTERNATE_ADDRESS = 2, JURIDICAL_ADDRESS = 3; 	
	private static HashMap<Integer, AddressType> map 
	= new HashMap<Integer, AddressType>();
	
	private int id;
	private String type;	

	// LOAD EVERYTHING INTO HASHMAP FOR QUICK REFERNECE IN THE FUTURE
	static{		
		for(AddressType t: AddressTypeDAO.getAll()){
			map.put(t.getId(), t);
		}		
	}
	
	public static AddressType getAddressType(int id){
		return map.get(id);
	}
	
	public AddressType(int id, String type) {
		this.id = id;
		this.type = type;
	}
	
	public int getId() {
		return id;
	}

	public String getType() {
		return type;
	}
	
	@Override
	public String toString() {	
		return getType();
	}
}
